home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 2.iso
/
ACORNUSERS
/
CBSA
/
EDUCATION
/
LOADER
/
cc
/
WimpIcon
< prev
next >
Wrap
Text File
|
1997-12-07
|
2KB
|
77 lines
//-----------------------------------
// WimpIcon.c
//-----------------------------------
#include <stdlib.h>
#include <string.h>
#include <os.h>
#include <trap.h>
#include "WimpError.h"
#include "WimpIcon.h"
WimpIcon::WimpIcon(WimpIcon &icon, int iflags, int window,
int priority, int x0, int y0, int x1, int y1)
{
int r[10];
os_error *e;
indirect = icon.indirect;
flags = iflags;
handle = window; // Provisoire
xmin = x0;
ymin = y0;
xmax = x1;
ymax = y1;
r[0] = priority;
r[1] = (int)&handle;
if ((e = os_swi(Wimp_CreateIcon, r)) != NULL) throw(e);
handle = r[0];
window_handle = window;
}
WimpIcon::WimpIcon(char *spritename, int iflags, int window, int priority,
int x0, int y0, int x1, int y1)
{
int r[10];
os_error *e;
if (iflags & INDIRECT)
{
indirect_sprite.sprite_name = new char[strlen(spritename)+1];
strcpy(indirect_sprite.sprite_name, spritename);
indirect_sprite.sprite_area = (int *)1;
indirect_sprite.isname = 1;
}
else strncpy(sprite_name, spritename, 12);
flags = iflags;
window_handle = window;
handle = window; // Provisoire
xmin = x0;
ymin = y0;
xmax = x1;
ymax = y1;
r[0] = priority;
r[1] = (int) &handle;
if ((e = os_swi(Wimp_CreateIcon, r)) != NULL) throw(e);
handle = r[0];
}
void WimpIcon::Delete()
{
int r[10];
os_error *e;
int b[2];
b[0] = window_handle;
if (b[0] < -1) b[0] = -2;
b[1] = handle;
r[1] = (int) b;
if ((e = os_swi(Wimp_DeleteIcon, r)) != NULL) throw(e);
}
WimpIcon::~WimpIcon()
{
if (flags & INDIRECT) delete indirect_sprite.sprite_name;
}